#!/bin/python3
# -*- coding: utf-8 -*-
# numpy.py
# @author 刘秋
# @email lq@aqiu.info
# @description 
# @created 2020-03-25T20:54:34.399Z+08:00
# @last-modified 2020-03-31T23:17:21.932Z+08:00
#

# 导入
import numpy as np

# 显示numpy的版本和配置信息
print(np.__version__)
print("*" * 80)
# np.show_config()
# 创建11的零向量
z = np.zeros(10)
print(z)
# 4 获取数组所占内存大小
z = np.zeros((10, 10))
print(z.size * z.itemsize)
# 查看帮助说明
# np.info(np.add)

# 6
Z = np.zeros(10)
Z[4] = 1
print(Z)

# 7
Z = np.arange(10, 50)
print(Z)

# 8 反转
Z = Z[::-1]
print(Z)
Z = np.flipud(Z)
print(Z)

# 9
Z = np.arange(0, 9).reshape(3, 3)
print(Z)

# 10
Z = [1, 2, 0, 0, 4, 0]
np.array(Z)
print(np.nonzero(Z))

# 11
Z = np.eye(3)
print(Z)
print("*" * 80)
# 12
Z = np.eye(3, 3, 3)
print(Z)
Z = np.random.random((3, 3, 3,))
print(Z)

# 13
Z = np.random.random((10,10))
Zmax,Zmin = Z.max(),Z.min()
print("Z max = {0} , z min = {1}".format(Zmax,Zmin))
#14
Z = np.random.random(30)
print("\n", Z.mean())

# 15
z = np.ones((10, 10))
print(z)
# 从第二个到倒数第二个，从第二排到倒数第二排
z[1:-1, 1:-1] = 0
print(z)

#16
